home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
PROGRAM
/
SNIP1292.ARJ
/
BITARRAY.C
< prev
next >
Wrap
Text File
|
1991-07-17
|
432b
|
16 lines
char set[(BITCOUNT + 7) / 8];
int getbit(char *set, int number)
{
set += number / 8;
return (*set & (1 << (number % 8))) != 0; /* 0 or 1 */
}
int setbit(char *set, int number, int value)
{
set += number / 8;
if (value)
*set |= 1 << (number % 8); /* set bit */
else *set &= ~(1 << (number % 8)); /* clear bit */
}